from game import zz_game
from zz import zz_log, zz_img

log = zz_log.of()


class Game(zz_game.ZZ_Game):
    def __init__(self, d, has_prize=True):
        super().__init__(d, has_prize)

    def get_name(self):
        return "金币大富翁"

    def handle_main(self):
        self.log_msg("等待进入游戏")
        self.img_click_for('点击开始游戏', './game/img/金币大富翁/start.png')
        self.log_msg("等待进入游戏主界面")
        self.img_exit('./game/img/金币大富翁/exists.png', 100)
        self.log_msg("已进入游戏主界面")

        while True:
            if self.alert_close('./game/img/金币大富翁/alert.png'):
                continue
            break

        if self.not_prize_handle():
            return False

        self.log_msg("开始点金币")
        while not self.check_done():
            self.img_click('./game/img/金币大富翁/play.png', 10, 50)

        # self.d.sleep(2)
        #        self.close_game()
        return True
